<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">



    <title>用户登录</title>

    <meta name="description" content="用户登录" />



    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

    <meta content="always" name="referrer">

    <link href="css/register.css" rel="stylesheet" type="text/css" />

    <link rel="shortcut icon" href="//static.fh21.com.cn/images/favicon.ico" type="image/x-icon" />

    <meta property="qc:admins" content="24062170223072466021637563675352747716" />

    <script type="text/javascript" src="js/jquery.min.js"></script>

    <script type="text/javascript" src="js/common.js"></script>

    <script type="text/javascript" src="js/ysHeader_v2.js"></script>





</head>

<body>



<!--页面头部区域开始-->

<div class="header">

    <div class="headerwrap">

        <ul class="head01">

            <a href="http://www.fh21.com.cn"><!--飞华健康网--></a>

        </ul>

        <ul class="head02">

            欢迎登录

        </ul>

    </div>

</div>

<!--页面头部区域结束-->





<div class="main_content">

    <div class="reg01">

        <p class="reg01_title">用户登录</p>

        <p class="reg01_icon"></p>

        <div class="reg01_con">

            <!--当为选中状态时，父层样式追加curr且图片样式设为空-->

            <form id="loginForm" action="" method="post">

                <ul class="reg01a" id='username_input'>

                    <img src="images/bg06a.gif" class="imgGray" id='imgname_1' style="left:17px;top:9px;"  />

                    <input name="username" id="username" type="text" value="用户名/手机号"/>

                    <input  type="hidden" name="returnurl" value="/user/login" id="returnurl" />

                </ul>

                <ul class="reg01a" id='password_input'>

                    <img src="images/bg06b.gif" class="imgGray" id='imgname_2' style="left:18px;top:7px;" />

                    <input name="" id="pass" type="text" value="密码"/>

                    <input name="password" id="password" type="password" value="" style="display:none"/>

                </ul>

                <ul class="reg01b">

                    <input id="record" type="checkbox"  onfocus="this.blur();" checked="checked" />

                    下次自动登录

                    <a href="/public/retrievepassword" class="link01">忘记密码？</a>

                </ul>

                <ul class="reg01c">

                    <input name="" type="button" class="reg_btn01" value="" onfocus="this.blur();" onmouseover="this.className='reg_btn01 reg_btn01_over'" id='login_user' onmouseout="this.className='reg_btn01'" />



                    <a href="/user/reg" class="link01">注册</a>

                </ul>

            </form>

            <div class="reg01d">

                <p>可以使用以下方式登录</p>

                <a href="/connect/tencent"><img src="images/icon01a.gif" />QQ</a>

                <a href="/connect/sina"><img src="images/icon01b.gif" />新浪微博</a>

                <!-- <a href="/connect/renren"><img src="//static.fh21.com.cn/images/passport/reg/icon01c.gif" />人人</a>  -->

            </div>

        </div>

    </div>

</div>







<!-- 引入验证码文开始件 -->

<script type="text/javascript" charset="utf-8">
    window.mobilecheck = function() {
        var check = false;
        (function(a){
            if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))
            {check = true;}
        })(navigator.userAgent||navigator.vendor||window.opera);
        return check; }
    var cssUrl = FHUrls.statics + "/css/verify/verify_pc.css";
    if(mobilecheck()){
        var cssUrl = FHUrls.statics + "/css/verify/verify.css";
    }
    var links = $("head").find('link[href="' + cssUrl + '"]');
    if (links.length == 0) {
        //"insert css file"
        var cssfile = $("<link/>", {
            "href" : cssUrl,
            "type" : "text/css",
            "rel" : "stylesheet"
        });
        var cssFiles = $("head").find('link[type="text/css"]');
        var jsFiles = $("head").find("script[type='text/javascript']");
        if (cssFiles.length != 0) {
            //考虑到 没有css 文件
            cssFiles.last().after(cssfile);
        } else if (jsFiles.length != 0) {
            //考虑到 没有js 文件
            jsFiles.first().before(cssfile);
        } else {
            $("head").append(cssfile);
        }
        //"insert css file" end
    }
</script>
<div id="overlay_verify" style="display:none;">
    <div id="overlay_verify_bg"> </div>
    <div class="win_open100 win0001" id="wrapper" >
        <ul>
            <!--  contenteditable="true"  onkeyup="console.log(value=value.replace('/^\w+$/'))" 解决浏览器兼容 -->
            <input maxlength="4" id="inputy_verify" name="" type="text" class="input01 validateCode" placeholder="请输入右侧的验证码" value="请输入右侧的验证码" />
            <img id="change_verify_show" class="change_verify"  style="position: absolute; left: 200px; _left: 184px;top: 0; width: 60px; height: 42px;" />
            <img class="codeCorrect" src="images/icon_yes.png" style="display: none;" /><!-- 验证码正确-->
            <img class="codeError" src="//static.fh21.com.cn/images/iask/wap/icon_no.png" style="display: none;" /><!-- 验证码错误-->
        </ul>
        <div class="control">
            <input id="submit_verify" type="button" name="name" value="确定" class="btn confirm" disabled="disabled" />
            <input type="button" name="name" value="取消" class="btn cancle" />
        </div>
    </div>
</div>
<script type="text/javascript">
    var validateDefault = "请输入右侧的验证码";
    $(function () {
        //文本框默认值的变化
        $("#inputy_verify").focusin(function (e) {
            e.stopPropagation();
            if ($(this).val() == validateDefault) {
                $(this).val("").removeClass("blur").addClass("focus");
            } else {
                $(this).removeClass("blur").addClass("focus");
            }
        }).focusout(function (e) {
            e.stopPropagation();
            if ($(this).val() == 0) {
                $(this).val(validateDefault).removeClass("focus").addClass("blur");
            } else {
                $(this).removeClass("blur").addClass("focus");
            }
            if($("#inputy_verify").val() == validateDefault){
                controler_css();
            }
        });
        //触发验证
        $("#inputy_verify").keyup(function () {
            var code = $.trim($(this).val());
            if (code.length >= 1) {//输入1个字符时，触发验证
                verifyCaptcha($.trim($('#inputy_verify').val()), function() {
                    //正确
                    $("#submit_verify").attr('disabled',false);
                    $(".codeCorrect").show();
                    $(".codeError").hide();
                }, function(statusCode) {
                    var error = '验证码错误';
                    if(statusCode === 10001) {
                        error = '验证码不能为空';
                    } else if(statusCode === 10002) {
                        error = '验证码错误';
                    }
                    //错误
                    controler_css();
                    $(".codeCorrect").hide();
                    $(".codeError").show();
                }, 'sendmessage');
            } else {
                controler_css();
            }
        });
        //取消(关闭弹层)
        $(".cancle").click(function () {
            closeWindow();
        });
    });
    /**
     * 验证验证码
     *
     * @param code		验证码
     * @param success	验证成功的回调函数
     * @param failure	验证失败的回调函数
     */
    function verifyCaptcha(code, success, failure, key) {
        // 解析参数
        var code 	= code;
        var success = typeof(success) == 'function' ? success : function() {};
        var failure = typeof(failure) == 'function' ? failure : function() { alert('验证码错误'); };
        var key     = key ? key : 'captchacode';

        // 错误代码
        var captcha_is_null  = 10001;
        var captcha_validate = 10002;
        var captcha_error    = 10003;

        // 验证验证码
        if(code === '') {
            failure(captcha_is_null);
            // } else if(!/^\w+$/.test(code)) {
        } else if(code.length < 2) {
            failure(captcha_validate);
        } else {
            $.getJSON(FHUrls.widget + '/captcha/verify?callback=?', {code: code, key: key}, function(response) {
                if(response.errno) {
                    failure(captcha_error);
                } else {
                    success();
                }
            });
        }
    }
    //验证码换一换
    $(".change_verify").click(function(){
        changeVerify();
    });
    //取消(关闭弹层)
    function closeWindow(){
        $("#inputy_verify").val(validateDefault).removeClass("focus").addClass("blur");
        controler_css();
        $("#overlay_verify,#wrapper").hide();
    }
    //控制样式显示,确定按钮不可点击
    function controler_css(){
        $(".codeCorrect").hide();
        $(".codeError").hide();
        $("#submit_verify").attr('disabled','disabled');
    }
    //验证码更换
    function changeVerify(){
        $(".change_verify").attr('src', "//widget.fh21.com.cn/captcha/create?width=80&height=30&length=4&key=sendmessage&time="+Date.parse(new Date()));
        if($("#inputy_verify").val() != validateDefault){
            $(".codeError").show();
        }
        $("#submit_verify").attr('disabled','disabled');
    }

</script>


<!-- 引入验证码文件结束 -->

</body>

</html>



<script>

    $(document).ready(function(){

//替换input type类型

        $('#pass').focus(function(){

            $('#password_input').addClass("curr");

            $("#imgname_2").removeClass("imgGray");

            $(this).hide();

            $('#password').show().focus();

        });

        $('#password').focus(function(){

            $('#password_input').addClass("curr");

            $("#imgname_2").removeClass("imgGray");

        });

        $('#password').blur(function(){

            $('#password_input').removeClass("curr");

            $("#imgname_2").addClass("imgGray");

            if($(this).val() ==''){

                $('#password').hide();

                $('#pass').show();

                $('#pass').val('密码');

            }

        });

        $('#username').focus(function(){

            $('#username_input').addClass("curr");

            $("#imgname_1").removeClass("imgGray");

            if($(this).val() == '' || $(this).val() == '用户名/手机号' ){

                $(this).val('');

            }

        }).blur(function(){

            $('#username_input').removeClass("curr");

            $("#imgname_1").addClass("imgGray");

            if($(this).val() == '' || $(this).val() == '用户名/手机号' ){

                $(this).val('用户名/手机号');

            }

        });

    });



    //回车事件

    $("#loginForm").keydown(function(evt){

        if (evt.which == 13)

        {

            loginSubmit();

        }

    }) ;

    // 表单提交

    $("#login_user").click(function(){

        loginSubmit();

        return false;

    });

    function loginSubmit(){

        var username = $.trim($("#username").val());

        var password = $.trim($("#password").val());

        var returnurl = $.trim($("#returnurl").val());

        var record = 0;

        if ($("#record").is(":checked")) {



            record = 1;

        };

        var error = true;

        if(username == '用户名/手机号'){

            username = '';

        }



        if(password == '密码'){

            password = '';

        }

        if (username =='') {

            alert('用户名不能为空');

            return false;

        };

        if (password =='') {

            alert('密码不能为空');

            return false;

        };

        var check_mobile = /^1[3|4|5|7|8|9][\d]{9}$/;

        var check_username = /^[a-zA-Z0-9_\u4e00-\u9fa5]{1,29}$/;

        // if(!check_mobile.exec(username)){

//	    if(!check_username.exec(username)){

//	     	alert('用户名或者密码错误');

//	      	return false;

//	    }

        //  }





        if(username && password){

            var loginUrl = '/user/checklogin';

            $.ajax({type:'post',url:loginUrl,dataType:'json',async:false,

                data:{username:username,password:password,record:record,returnurl:returnurl},

                complete: function(){

                    $("#login_user").attr('disabled',false);



                },

                beforeSend: function(){

                    $("#login_user").attr('disabled','disabled');

                },

                success: function(json){

                    if(json.errno == 0 && json.uid>0){

                        location.href = json.returnurl;

                    } else if(json.errno == 10103){

                        alert('该账号已被锁定,禁止登陆');

                        return false;

                    } else if(json.errno == 10104){

                        alert('该用户已被删除,请联系客服');

                        return false;

                    } else {

                        alert('用户名或者密码错误');

                        return false;

                    }

                }

            });

        }

        return false;

    }

</script>



